﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LINQ = JLL.China.Infrastructure.Repositories.LINQ2SQL;
using JLL.China.Infrastructure.Repositories.ListingMedia;
using JLL.China.Model;
namespace JLL.China.Infrastructure.Repositories.ListingMedia
{

    public static class ListingMediaFactory
    {
        public static Model.ListingMedia FromLINQObject(LINQ.ListingMedia item)
        {
            if (item == null)
            {
                return null;
            }
            else
            {
                var model = new Model.ListingMedia
                {
                    ID = Int32.Parse(item.Media_ID.ToString()),
                    ListingsFID = item.ListingsFID,
                    Filename = item.Filename,
                    FileData = item.FileData,
                    IsActive = item.IsActive,
                    IsDefault = item.IsDefault,
                    Orders = item.Orders,
                    TypeOfUpload = item.TypeOfUpload,
                    ImgType = item.ImgType

                };
                return model;
            }
        }
        public static LINQ.ListingMedia ToLINQObject(Model.ListingMedia item)
        {
           
                var model = new LINQ.ListingMedia
                {
                    Media_ID = item.ID,
                    ListingsFID = item.ListingsFID,
                    Filename = item.Filename,
                    FileData = item.FileData,
                    IsActive = item.IsActive,
                    IsDefault = item.IsDefault,
                    Orders = item.Orders,
                    TypeOfUpload = item.TypeOfUpload,
                    ImgType = item.ImgType


                };
                return model;
            
        }
    }
}
